<?php

namespace App\Http\Requests\Api\v2;

use App\Http\Requests\CommonRequest;
use App\Rules\phone;

class AddressRequest extends CommonRequest
{
    public $scenes = [
        'edit' => 'id,name,tel,address,detail_address',
        'order_pay' => 'order_id',
        'shopOrders' => 'restaurant_id'
    ];

    public function rules()
    {
        return [
            'name' => ['required'],
            'tel' => ['required','integer',new phone() ],
            'address' => ['required'],
            'detail_address' => ['required'],
        ];
    }
    public function editRules(){
        return [
            'id' => ['required','integer'],

        ];
    }

    public function messages()
    {
        return [
            'name.required' => "收餐人不能为空",
            'address.required' => "地址不能为空",
            'tel.required' => "电话不能为空",
            'tel.integer' => "电话必须是数字",
            'detail_address.required' => "详细地址不能为空",
            'id.required' => "id不能为空",
            'id.integer' => "id必须是数字",
        ];
    }
}
